package com.sntk.organauthomanager.application.dto;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sntk.organauthomanager.infrastructure.validation.Update;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @ClassName: ResourceDTO
 * @author: wgchao
 * @createTime: 2020/7/21 4:25 PM
 * @Description: TODO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(content = JsonInclude.Include.NON_NULL)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
public class ResourceDTO implements Serializable {

    @NotNull(message = "ID缺失", groups = Update.class)
    private Long id;

    //资源标识
    @NotBlank(message = "资源标识缺失", groups = Update.class)
    private String mark;

    //资源名称
    @NotBlank(message = "资源名称缺失", groups = Update.class)
    private String name;

    //资源类型
    @NotNull(message = "资源类型缺失", groups = Update.class)
    private Integer resourceType;

    //资源深度 1代表一级
    @NotNull(message = "资源深度缺失", groups = Update.class)
    private Integer depth;

    private String parentResource;

    @NotNull(message = "禁用状态缺失", groups = Update.class)
    private Boolean disabled;

    private Boolean del;

    private Date createTime;

    private String creator;

    private Date lastUpdateTime;

    private String lastUpdator;


    //乐观锁 ObjectOptimisticLockingFailureException异常
    @NotNull(message = "版本号缺失", groups = Update.class)
    private Long version;
}
